package net.helpfulwebservices.cogitologopedia;

import net.helpfulwebservices.cogitologopedia.ws.wsResponse;
import net.helpfulwebservices.cogitologopedia.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class Activity_option extends Activity {
	
	//private wsResponse _wsResponse;
	
	public Activity_option(){
		//this.setNavigationTicket(null);
	}
	public Activity_option(wsResponse ws){
		//this.setNavigationTicket(ws);
	}
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_option);

        Spinner spinner = (Spinner) findViewById(R.id.cboMatrix);
        this.createSpinner(this,spinner);

	}

	
    public void bttStart_onClick(View view) {
    	GameInfo g = this.createGameInfo();
    	Log.v("Activity_option", g.toString());
		Intent intent = new Intent(view.getContext(),Activity_game.class);
		intent.putExtra("X",g.getX()); 
		intent.putExtra("Y",g.getY()); 
		startActivity(intent);
    }
	
    
    /*
     * creo la classe sulle informazioni del gioco
     */
	public GameInfo createGameInfo(){
    	Spinner cboCombo = (Spinner) this.findViewById(R.id.cboMatrix);
    	String ss = cboCombo.getSelectedItem().toString();
    	GameInfo g = new GameInfo(ss);
    	return g;
	}

	/*
	 * creo la combo con i valori necessari
	 */
	public Spinner createSpinner(Context c, Spinner spinner){
    	ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(c,
    	        R.array.matrix_array, android.R.layout.simple_spinner_item);
    	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    	spinner.setAdapter(adapter);
    	return spinner;
	}
	
/*
	public void setNavigationTicket(wsResponse ws){
		this._wsResponse=ws;
	}
	
	public wsResponse getNavigationTicket(){
		return this._wsResponse;
	}
*/
}
